import request from '@/utils/request'

// 获取权限列表
export function getPermissionList(params) {
  return request({
    url: '/permission/permissionList', 
    method: 'get',
    params
  })
}

// 分页查询权限
export function getPermissionPage(params) {
  return request({
    url: '/permission/pagePermission',
    method: 'get',
    params
  })
}

// 获取权限详情
export function getPermissionDetail(id) {
  return request({
    url: `/permission/permissionDetail/${id}`,
    method: 'get'
  })
}

// 添加权限
export function addPermission(data) {
  return request({
    url: '/permission/addPermission',
    method: 'post',
    data
  })
}

// 更新权限
export function updatePermission(data) {
  return request({
    url: '/permission/updatePermission',
    method: 'post',
    data
  })
}

// 删除权限
export function deletePermission(id) {
  return request({
    url: `/permission/deletePermission/${id}`,
    method: 'delete'
  })
}

// 批量删除权限
export function deleteBatchPermission(ids) {
  return request({
    url: '/permission/deleteBatch',
    method: 'post',
    data: ids
  })
}

// 获取权限树
export function getPermissionTree() {
  return request({
    url: '/permission/getPermissionTree',
    method: 'get'
  })
}

// 更新权限状态
export function updatePermissionStatus(data) {
  return request({
    url: '/permission/updateStatus',
    method: 'post',
    data
  })
}
